import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Component({
  selector: 'app-commodity-details',
  templateUrl: './commodity-details.component.html',
  styleUrls: ['./commodity-details.component.css']
})
export class CommodityDetailsComponent implements OnInit {
  // 获取商品信息
  public getShops: any;
  // tabbar
  public shoppingMallImg1: any = '../../assets/img/u170.png';
  // public shoppingMallImg2: any = '../../assets/img/u642.png';
  public shoppingMallImg3: any = '../../assets/img/shopCar.png';
  public evaluteNumbers: any = 88;
  // public i: any = 20;
  public flag: any = true;
  public e: any;

  // 评论信息
  public headers: any;
  public headerName: any = '67890';
  public date: any = new Date();
  public content: any = 'ergeffergd13ff';
  constructor(public http: HttpClient) { }

  ngOnInit() {
    //  获取所有商品信息
    const getShops = 'http://192.168.2.228:8080/goods/list';
    this.http.get(getShops).subscribe((response: any) => {
      console.log(response);
      this.getShops = response.data.list;
    });
  }

  AddCar() {
    const display = document.getElementById('add-car');
    display.style.display = 'block';
    // console.log(this.e);
  }

  buyNow() {
    const buy = document.getElementById('add-car');
    buy.style.display = 'block';
  }

  // disNone() {
  //   const display = document.getElementById('add-car');
  //   display.style.display = 'none';
  //   const buy = document.getElementById('add-car');
  //   buy.style.display = 'none';
  // }
  goShopDetails() {
    // console.log(this.commodity);
    this.flag = true;
  }

  goShopEvaluate() {
    // console.log(this.commodity);
    this.flag = false;
  }

}
